package algebra.visitors;

import kb.DescriptionLogicsKB;
import algebra.OrderingDescription;
import algebra.op.PQuery;
import algebra.op.ScanQuery;

/**
 * Determine what cached results to be selected/created for the given Scan query.
 * @author j55wu
 *
 */
public class ScanQueryVisitorCacheSelector {
	private DescriptionLogicsKB kb;
	private OrderingDescription od;
	

	public ScanQueryVisitorCacheSelector(DescriptionLogicsKB kb, OrderingDescription od) {
		super();
		this.kb = kb;
		this.od = od;
	}
	
	public void visit(ScanQuery sq){
		this.buildPI(sq);
	}
	
	private void buildPI(ScanQuery sq){
		PQuery pq = new PQuery(); 
		QueryVisitorEvaluator eval = new QueryVisitorEvaluator(this.kb, this.od);
		sq.setCache(pq.acceptVisitor(eval));
	}
}
